package cn.stylefeng.guns.modular.gridsystem.mapper;

import cn.stylefeng.guns.modular.gridsystem.entity.BizException;
import cn.stylefeng.guns.modular.gridsystem.model.param.BizExceptionParam;
import cn.stylefeng.guns.modular.gridsystem.model.result.BizExceptionResult;
import cn.stylefeng.guns.modular.gridsystem.model.result.DeviceExceptionInfoResult;
import cn.stylefeng.guns.modular.gridsystem.model.result.ExceptionCountDataResult;
import cn.stylefeng.guns.modular.gridsystem.model.result.ExceptionHandleDataResult;
import cn.stylefeng.guns.modular.gridsystem.mqtt.result.FaultHistory;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 故障表 Mapper 接口
 *
 * @author ssy
 * @date 2021/09/14 11:47
 */
public interface BizExceptionMapper extends BaseMapper<BizException> {

    int insertAndReturnId(@Param("param") BizExceptionParam bizExceptionParam);

    Page<Map<String, Object>> pageList(@Param("page") Page page, @Param("param") BizExceptionParam param, @Param("list") String[] list);

    Map<String, Long> countStatus(@Param("deviceId") Integer deviceId);

    List<ExceptionCountDataResult> getErrorCountByMonth(@Param("stationId") Integer stationId);

    Page<BizExceptionResult> page(@Param("page") Page page, @Param("param") BizExceptionParam param);

    Page<FaultHistory> faultHistoryPage(@Param("page") Page page, @Param("startTime") String startTime, @Param("endTime") String endTime);

    List<BizExceptionResult> getDeviceExceptionList(@Param("stationId") Integer stationId ,@Param("deviceId") Integer deviceId, @Param("startTime") String startTime, @Param("endTime") String endTime);

    ExceptionHandleDataResult getExceptionHandleInfo(@Param("stationId") Integer stationId);

    Page<DeviceExceptionInfoResult> getDeviceExceptionInfoList(@Param("page") Page page, @Param("deviceId") Integer deviceId);
}
